package com.cxh.rmsq.ui.adapter.self

import android.content.Intent
import android.graphics.Color
import android.view.View
import android.widget.TextView
import androidx.core.view.isVisible
import com.blankj.utilcode.util.TimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cxh.rmsq.R
import com.cxh.rmsq.common.IntentExtra
import com.cxh.rmsq.db.model.CommunityContent
import com.cxh.rmsq.db.model.PayListBean
import com.cxh.rmsq.ui.activity.self.CommentDetailActivity
import com.cxh.rmsq.ui.activity.self.LookUserDetailActivity2
import com.cxh.rmsq.ui.widget.SelectableRoundedImageView
import com.cxh.rmsq.utils.loadImage


/**
 *
 */
class MyBillListAdapter() :
    BaseQuickAdapter<PayListBean, BaseViewHolder>(R.layout.item_my_bill_list),
    LoadMoreModule {


    override fun convert(holder: BaseViewHolder, item: PayListBean) {
        with(holder) {

            setText(R.id.tv_name, item.payContent)
            setText(R.id.tv_time, TimeUtils.millis2String(item.payTime))
            setText(R.id.tv_pay_no, "交易单号：" + item.payCode.toString())
            setText(
                R.id.tv_price,
                if (item.type == 1) "-￥" + item.payPrice.toString() else "+￥" + item.payPrice.toString()
            )

            if (item.type == 1) {
                holder.getView<View>(R.id.view).setBackgroundColor(Color.parseColor("#F8CF6A"))
            } else {
                holder.getView<View>(R.id.view).setBackgroundColor(Color.parseColor("#40E1A6"))

            }
//            loadImage(item.avatar, holder.getView<SelectableRoundedImageView>(R.id.siv_header))

        }
    }

}